CCM.coupled_cluster

Provides functions for setting up the coupled cluster equations on the lattice and solving for them

Functions

ccsd_energy(f_ph, v_pphh, t2, t1)

computes ccsd correlation energy Note: Technically, this would need v_hhpp but this is of course the transpose of v_pphh; Likewise, f_hp is required, and this is just the transpose of f_ph which we have

ccsd_solver(fock_mats, two_body_int[, ...])

Solves for the correlation energy of a system using the CCSD equations.

get_all_interactions(part, hole, mycontact)

This routine takes the relatively small number of two-body matrix elements in mycontact and sorts them into the four-indexed interaction tensors.

get_fock_matrices(part, hole, myTkin, ...)

constructs fock matrices from one-body interaction and rank-4 tensors of two-body force

get_norm_ord_int(thisL, holes, vT1, vS1[, ...])

Takes all the necessary parameters to generate the fock matrices, two and three body interactions to perform CCM

get_norm_ordered_ham(thisL, holes, myTkin, ...)

Takes all the necessary parameters to generate the fock matrices, two and three body interactions to perform CCM

get_ref_energy(no_1b_hh, no_2b_hhhh[, w_hhh_hhh])

Computes the energy of the reference state from normal ordered interactions

t1Init(f_ph, f_pp, f_hh, delta)

Initializes t_i^a based on the perturbation theory guess

t1Iter(t1, t2, f_ph, f_pp, f_hh, v_phph, ...)

iterating t1 using the CCSD equations

t2Init(f_pp, f_hh, v_pphh, delta)

Initializes t_{ij}^{ab} based on perturbation theory guess

t2Iter(t1, t2, f_ph, f_hh, f_pp, v_pppp, ...)

iterating t2, factoring out terms that look like g_i^i and g_a^a

CCM.coupled_cluster.get_fock_matrices(part, hole, myTkin, v_phph, v_phhh, v_hhhh)

constructs fock matrices from one-body interaction and rank-4 tensors of two-body force

Parameters:
  • part (list[int]) – list of particle indices

  • hole (list[int]) – list of hole indices

  • myTkin (list[(int, int, float)]) – list of one-body matrix elements

  • v_phph (numpy array) – two body interaction matrix V^{ai}_{bj}

  • v_phhh (numpy array) – two body interaction matrix V^{ai}_{jk}

  • v_hhhh (numpy array) – two body interaction matrix V^{ij}_{kl}

Returns:

Fock matrices f_pp, f_ph, f_hh

Return type:

numpy array, numpy array, numpy array

CCM.coupled_cluster.get_all_interactions(part, hole, mycontact, sparse=False)

This routine takes the relatively small number of two-body matrix elements in mycontact and sorts them into the four-indexed interaction tensors. It also anti-symmetrizes the latter whenin and out indices run over the same set of particle/hole indices.

Parameters:
  • part (list[int]) – list of particle-space indices

  • hole (list[int]) – list of hole-space indices

  • mycontact (list[(int, int, int, int, float)]) – list of two-body matrix elements

  • sparse (bool) – Optional; whether or not v_pppp and v_ppph should be stored as sparse arrays or not

Returns:

Two body matrices v_pppp, v_ppph, v_pphh, v_phph, v_phhh, v_hhhh as rank-four tensors.

Return type:

numpy array | sparse array, numpy array | sparse array, numpy array, numpy array, numpy array, numpy array

CCM.coupled_cluster.ccsd_energy(f_ph, v_pphh, t2, t1)

computes ccsd correlation energy Note: Technically, this would need v_hhpp but this is of course the transpose of v_pphh; Likewise, f_hp is required, and this is just the transpose of f_ph which we have

Parameters:
  • f_ph (numpy array) – Fock matrix f^{a}_{i}

  • v_pphh (numpy array) – two body interaction matrix V^{ab}_{ij}

  • t1 (numpy array) – T^{a}_{i} from the coupled cluster equations

  • t2 (numpy array) – T^{ab}_{ij} from the coupled cluster equations

Returns:

CCSD correlation energy

Return type:

float

CCM.coupled_cluster.get_ref_energy(no_1b_hh, no_2b_hhhh, w_hhh_hhh=None)

Computes the energy of the reference state from normal ordered interactions

Parameters:
  • no_1b_hh (numpy array) – Fock matrix (including contributions from 3NF if w_hhh_hhh is not None)

  • no_2b_hhhh (numpy array) – numpy array, normal-ordered TBME including contributions from 3NF if w_3b is not None

  • w_hhh_hhh (list[(int, int, int, int, int, int, float)]) – list of nonzero elements of 3NF or None if not using

Returns:

energy of reference state

Return type:

float

CCM.coupled_cluster.t1Init(f_ph, f_pp, f_hh, delta)

Initializes t_i^a based on the perturbation theory guess

Parameters:
  • f_ph (numpy array) – Fock matrix f^a_i

  • f_pp (numpy array) – Fock matrix f^a_b

  • f_hh (numpy array) – Fock matrix f^i_j

  • delta (float) – Energy gap to make sure there is no division by 0 errors

Returns:

t_i^a initial guess

Return type:

numpy array

CCM.coupled_cluster.t1Iter(t1, t2, f_ph, f_pp, f_hh, v_phph, v_phhh, v_pphh, v_ppph_results, sparse=True)

iterating t1 using the CCSD equations

Parameters:
  • t1 (numpy array) – t^a_i from the previous iteration

  • t2 (numpy array) – t^{ab}_{ij} from the previous iteration

  • f_ph (numpy array) – Fock matrix f^a_i

  • f_pp (numpy array) – Fock matrix f^a_b

  • f_hh (numpy array) – Fock matrix f^i_j

  • v_phph (numpy array) – two body interaction matrix V^{ai}_{bj}

  • v_phhh (numpy array) – two body interaction matrix V^{ai}_{jk}

  • v_pphh (numpy array) – two body interaction matrix V^{ab}_{ij}

  • v_ppph_results (numpy array | list[numpy array]) – two body interaction matrix V^{ab}_{ci} if sparse = False, results from CCM.ccDgrams.v_ppph_dgrams() otherwise

  • sparse (bool) – whether or not v_pppp and v_ppph are stored as sparse arrays or not

Returns:

updated t_i^a

Return type:

numpy array

CCM.coupled_cluster.t2Init(f_pp, f_hh, v_pphh, delta)

Initializes t_{ij}^{ab} based on perturbation theory guess

Parameters:
  • f_pp (numpy array) – Fock matrix

  • f_hh (numpy array) – Fock matrix

  • v_pphh (numpy array) – two body interaction matrix V^{ab}_{ij}

  • delta (float) – Energy gap to avoid division by 0 errors

Returns:

t^{ab}_{ij} based on perturbation theory guess

Return type:

numpy array

CCM.coupled_cluster.t2Iter(t1, t2, f_ph, f_hh, f_pp, v_pppp, v_phph, v_phhh, v_pphh, v_ppph_results, v_hhhh, sparse=True)

iterating t2, factoring out terms that look like g_i^i and g_a^a

Parameters:
  • t1 (numpy array) – t^a_i from the previous iteration

  • t2 (numpy array) – t^{ab}_{ij} from the previous iteration

  • f_ph (numpy array) – Fock matrix f_i^a

  • f_hh (numpy array) – Fock matrix f_i^j

  • f_pp (numpy array) – Fock matrix f_a^b

  • v_pppp (numpy array | list[(int, int, int, int, float)]) – two body interaction matrix V^{ab}_{cd}; optionally stored as a sparse array

  • v_phph (numpy array) – two body interaction matrix V^{ai}_{bj}

  • v_phhh (numpy array) – two body interaction matrix V^{ai}_{jk}

  • v_pphh (numpy array) – two body interaction matrix V^{ab}_{ij}

  • v_ppph_results (numpy array | list[numpy array]) – if not sparse, the two body interaction matrix V^{ab}_{ci}, but if sparse=True, it is the contributions to T2 from the V^{ab}_{ci} diagrams

  • v_hhhh (numpy array) – two body interaction matrix V^{ij}_{kl}

  • sparse (bool) – whether or not v_pppp and v_ppph are stored as sparse arrays or not

Returns:

updated t_ij^ab

Return type:

numpy array

CCM.coupled_cluster.ccsd_solver(fock_mats, two_body_int, t1initial=None, eps=1e-08, maxSteps=1000, max_diis=10, delta=0, mixing=0.5, verbose=False, sparse=True, ccs=False)

Solves for the correlation energy of a system using the CCSD equations. DIIS credit to Daniel G. A. Smith and Lori A. Burns, and The Psi4NumPy Developers, https://github.com/psi4/psi4numpy

Parameters:
  • fock_mats (list[numpy array]) – Fock matrices

  • two_body_int (list[numpy array]) – two body interaction matrices; if sparse the first two elements will be lists instead of numpy arrays

  • eps (float) – Optional; max relative error

  • maxSteps (int) – Optional; max number of iterations to take

  • max_diis (int) – Optional; size of DIIS array. Set to 0 to not perform DIIS

  • delta (float) – Optional; energy gap for first iteration to avoid division by 0 errors

  • mixing (float between 0 and 1) – Optional; how much of the previous step to mix into the current one. Set to 0 if you don’t want any mixing from the previous step

  • verbose (bool) – Optional; whether or not to print steps as they are calculated

  • sparse (bool) – Optional; whether or not v_pppp and v_ppph are stored as sparse arrays or not

  • ccs (bool) – Optional; whether to perform just the ccs equations or not

Returns:

correlation energy, t1, and t2

Return type:

float, numpy array, numpy array

CCM.coupled_cluster.get_norm_ord_int(thisL, holes, vT1, vS1, str_3NF=0, sparse=True)

Takes all the necessary parameters to generate the fock matrices, two and three body interactions to perform CCM

Parameters:
  • thisL (int) – number of lattice sites in each direction

  • holes (list[list[int]]) – list of holes in the format [x, y, z, tz+0.5, sz+0.5]. To generate these, see lattice.makeState()

  • vT1 (float) – strength of T=1 coupling

  • vS1 (float) – strength of S=1 coupling

  • str_3NF (float) – Optional strength of T=1 coupling

  • sparse (bool) – Optional whether or not to store v_pppp and v_ppph as a sparse array or not

Returns:

The reference energy and three lists, a list of the three fock matrices in the order f_pp, f_ph, f_hh, all of the two body interactions in the order v_pppp, v_ppph, v_pphh, v_phph, v_phhh, v_hhhh

CCM.coupled_cluster.get_norm_ordered_ham(thisL, holes, myTkin, mycontact, my3body=None, sparse=True, NO2B=True)

Takes all the necessary parameters to generate the fock matrices, two and three body interactions to perform CCM

Parameters:
  • thisL (int) – number of lattice sites in each direction

  • holes (list[list[int]]) – list of holes in the format [x, y, z, tz+0.5, sz+0.5]. To generate these, see lattice.makeState()

  • myTkin (list[list[int, int, float]]) – list of one-body matrix elements [[p,q,T]…]

  • mycontact (list[list[int, int, int, int, float]]) – list of two-body matrix elements [[p,q,r,s,V]…]

  • my3body (list[list[int, int, int, int, int, int, float]]) – list of two-body matrix elements [[p,q,r,s,u,v,W]…]

  • sparse (bool) – Optional whether or not to store v_pppp and v_ppph as a sparse array or not

  • NO2B (bool) – whether or not to apply the normal-order two-body approximation, i.e. to return None for the three body interaction

Returns:

The reference energy and three lists, a list of the three fock matrices in the order [f_pp, f_ph, f_hh], all of the two body interactions in the order [v_pppp, v_ppph, v_pphh, v_phph, v_phhh, v_hhhh], and all of the three body interactions in the order [w_ppp_pph, w_ppp_phh, w_pph_pph, w_ppp_hhh, w_pph_phh, w_pph_hhh, w_phh_phh, w_phh_hhh, w_hhh_hhh], or [] if my3body = None or NO2B = True

Return type:

float, list[numpy array], list[numpy array], list[numpy array]